﻿using System;

namespace IOA.MES.DataAccess.VModel
{
    /// <summary>
    /// 车间班次表
    /// </summary>
    public class VWorkshopDuty : BaseVModel
    {
        private string _dutyName = string.Empty;
        private string _workshopName;
        private string _workshopCode;

        #region Public Property

        ///<Summary>
        /// 车间代码
        ///</Summary>
        public string WorkshopCode
        {
            get { return string.IsNullOrWhiteSpace(_workshopCode) ? string.Empty : _workshopCode; }
            set { _workshopCode = value; }
        }

        ///<Summary>
        /// 车间名称
        ///</Summary>
        public string WorkshopName
        {
            get { return string.IsNullOrWhiteSpace(_workshopName) ? string.Empty : _workshopName; }
            set { _workshopName = value; }
        }

        ///<Summary>
        /// 班次名称
        ///</Summary>
        public string DutyName
        {
            get { return string.IsNullOrWhiteSpace(_dutyName) ? string.Empty : _dutyName; }
            set { _dutyName = value; }
        }

        ///<Summary>
        /// 上班时间
        ///</Summary>
        public TimeSpan? StartTime { get; set; }

        ///<Summary>
        /// 下班时间
        ///</Summary>
        public TimeSpan? EndTime { get; set; }

        ///<Summary>
        /// 工作时间
        ///</Summary>
        public string WorkTime
        {
            get { return (!StartTime.HasValue ? string.Empty : $"{StartTime.Value.Hours.ToString("00")}:{StartTime.Value.Minutes.ToString("00")}:{StartTime.Value.Seconds.ToString("00")}") + "至" + (!EndTime.HasValue ? string.Empty : $"{ EndTime.Value.Hours.ToString("00")}:{ EndTime.Value.Minutes.ToString("00")}:{ EndTime.Value.Seconds.ToString("00")} "); }
        }

        ///<Summary>
        /// 状态
        ///</Summary>
        public Enum.CommonStatus Status { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public string CNStatus
        {
            get { return !System.Enum.IsDefined(typeof(Enum.CommonStatus), Status) ? string.Empty : EnumConvert.ToDesc(Status); }
        }
        #endregion
    }
}
